<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
      xmlns="http://www.w3.org/1999/xhtml"
      lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Index</title>
    <link rel="stylesheet" href="/static/css/bootstrap.min.css">
    <link rel="stylesheet" href="/static/css/material-icons.css">
    <link rel="stylesheet" href="/static/css/content/index.css">
    <script src="/static/js/jquery.min.js"></script>
    <script src="/static/js/bootstrap.min.js"></script>
    <script src="/static/js/vue-min.js"></script>
</head>
<body>


<nav class="navbar navbar-expand-lg navbar-light border-danger" id="nav-title">
    <div id="logo" class="col-md-2" style="text-align:center;">
        <img src="/static/img/logo.png">
    </div>
    <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent"
            aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
        <span class="navbar-toggler-icon"></span>
    </button>

    <div class="collapse navbar-collapse" id="navbarSupportedContent">
        <ul id="title-hover" class="navbar-nav mr-auto">
            <li class="nav-item active">
                <span class="nav-link">大象云音乐</span>
            </li>
            <li class="nav-item ">
                <a class="nav-link" href="/"> <span>首页</span></a>
            </li>
            <li class="nav-item ">
                <a class="nav-link" href="/user/profile"> <span>我的音乐</span></a>
            </li>
            <li class="nav-item">
                <a class="nav-link" href="/discovery"><span>推荐歌单</span></a>
            </li>
        </ul>
        <form class="form-inline my-2 my-lg-0" id="searchForm" action="/search/page">
            <input class="form-control mr-sm-2" type="search" placeholder="Search" name="key" aria-label="Search">
        </form>
        <ul class="navbar-nav" id="log-btns">
            <li class="nav-item" th:if="${session.user == null}">
                <a class="btn btn-primary" data-toggle="modal" data-target="#loginModel">登录</a>
            </li>
            <li class="nav-item" th:if="${session.user == null}">
                <a class="btn btn-link" href="/sign/page">注册</a>
            </li>
            <li class="nav-item" th:if="${session.user != null}">
                <a class="btn btn-link" @click="logout">注销</a>
            </li>
            <li class="nav-item" th:if="${session.user != null && session.user.permission.equals('admin')}">
                <a class="btn btn-link" href="/admin/page">后台</a>
            </li>
        </ul>
    </div>
</nav>
<!-- Modal 登录 -->
<div class="modal fade" id="loginModel" tabindex="-1" role="dialog" aria-labelledby="loginModelTitle"
     aria-hidden="true">
    <div class="modal-dialog modal-dialog-centered" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <h5 class="modal-title" id="loginModalLongTitle">登录账号</h5>
                <span v-bind:class="{'badge badge-pill badge-danger':isFailed}"
                      v-bind:hidden="hiddenSpan">{{warning}}</span>
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">&times;</span>
                </button>
            </div>
            <div class="modal-body">
                <div id="loginForm">
                    <div class="form-group">
                        <label for="num">号码</label>
                        <input type="text" class="form-control" name="number" id="num" v-model="num"
                               placeholder="请输入手机号">
                    </div>
                    <div class="form-group">
                        <label for="pwd">密码</label>
                        <input type="password" class="form-control" name="password" id="pwd" v-model="pwd"
                               placeholder="请输入密码">
                    </div>
                </div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-secondary" data-dismiss="modal">关闭</button>
                <button type="button" class="btn btn-primary" @click="login" >确定</button>
            </div>
        </div>
    </div>
</div>
<div class="container">
    <div class="row" id="head1">
        <div class="container">
            <div class="row">
                <!-- 轮播图 -->
                <div class="col-md-12" id="scrollImgs">
                    <div id="carouselExampleIndicators" class="carousel slide" data-ride="carousel">
                        <ol class="carousel-indicators">
                            <li data-target="#carouselExampleIndicators" data-slide-to="0" class="active"></li>
                            <li data-target="#carouselExampleIndicators" data-slide-to="1"></li>
                            <li data-target="#carouselExampleIndicators" data-slide-to="2"></li>
                        </ol>
                        <div class="carousel-inner">
                            <div class="carousel-item active">
                                <img class="d-block w-100" src="/static/img/a.jpg" alt="First slide">
                            </div>
                            <div class="carousel-item">
                                <img class="d-block w-100" src="/static/img/b.jpg" alt="Second slide">
                            </div>
                            <div class="carousel-item">
                                <img class="d-block w-100" src="/static/img/c.jpg" alt="Third slide">
                            </div>
                        </div>
                        <a class="carousel-control-prev" href="#carouselExampleIndicators" role="button"
                           data-slide="prev">
                            <span class="carousel-control-prev-icon" aria-hidden="true"></span>
                            <span class="sr-only">Previous</span>
                        </a>
                        <a class="carousel-control-next" href="#carouselExampleIndicators" role="button"
                           data-slide="next">
                            <span class="carousel-control-next-icon" aria-hidden="true"></span>
                            <span class="sr-only">Next</span>
                        </a>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="container" id="mainContent">
        <div class="row" style="margin-top:20px">
            <div class="col-md-8">
                <div class="col-md-12">
                    <ul id="cates" class="text-center text-light">
                        <li><a class="badge badge-danger" id="hot-cate" href="/category/page">最新热曲</a></li>
                        <li class="item" v-for="(s,index) in styles" v-if="index < 5">
                            <a class="text-info" href="#" @click="toStylePage(s)">{{s}}</a>
                        </li>
                        <li class="">
                            <a href="/category/page" class="text-success">更多>></a>
                        </li>
                    </ul>
                </div>
                <hr class="bg-info" style="border-width:3px">
                <div class="col-md-12">
                    <div class="row music-panel-row" v-for="songArray in neweastMusics">
                        <div class="col-md-3" v-for="song in songArray">
                            <div class="music-panel">
                                <div class="header">
                                    <img v-bind:src="song.imgUri">
                                    <div >
                                        <a :href="'/play?id='+song.pk">
                                            <i class="material-icons">play_arrow</i>
                                            <span style="margin-left: 7%;color: white">{{song.click}} clicks</span>
                                        </a>
                                    </div>
                                </div>
                                <div class="content">
                                    {{song.name}}
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="col-md-4">
                <div class="card" id="rank-card" style="width: 100%;">
                    <div class="card-body">
                        <h5 class="card-title text-info">点击榜</h5>
                        <hr>
                        <ol id="ranks">
                            <li class="text-center" v-for="song in topMusics">
                                <a :href="'/play?id='+song.pk" class="text-dark" v-if="song.name.length < 10">{{song.name}}</a>
                                <a :href="'/play?id='+song.pk" class="text-dark" v-if="song.name.length >= 10">{{song.name.substring(0,10)}}...</a>
                            </li>
                        </ol>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script src="/static/js/content/index.js"></script>

</body>
</html>